package castledefense.util;

public class Log {

	private static boolean g1 = false;
	private static boolean g2 = false;
	private static boolean g3 = true;
	private static boolean r1 = false;
	private static boolean k1 = true;

	static long totalTimer = 0;
	static long count = 1;
	static long timer = 0;
	static long startTimeMicro = 0;
	
	static long time = 0;

	public static void g1(Object object) {
		if (g1) {
			System.out.println(object);
		}
	}

	public static void g2(Object object) {
		if (g2) {
			System.out.println(object);
		}
	}

	public static void g3(Object object) {
		if (g3) {
			System.out.println(object);
		}
	}

	public static void r1(Object object) {
		if (r1) {
			System.out.println(object);
		}
	}

	public static void k1(Object object) {
		if (k1) {
			System.out.println(object);
		}
	}
	
	public static void startTimerMicro(){
		startTimeMicro = System.nanoTime();
	}
	
	public static int stopTimerMicro(){
		long endTime = System.nanoTime();
		int delta = (int) ((endTime-startTimeMicro)/(1000));
		return delta;
	}
	
	/** Average timer, call  timerStart() before lines you want 
	 * measure and  timerStop() right after
	 * */
	public static void timerStart() {
		timer = System.nanoTime();
	}

	public static void timerStop() {
		timer -= System.nanoTime();
		timer /= -1000;
		totalTimer += timer;
		System.out.println(totalTimer / ++count + " micro Seconds");
	}
	
	/** Precise timer, call  timeStart() before lines you want 
	 * measure and  timeStop() right after
	 * */
	public static void timeStart() {
		time = System.nanoTime();
	}

	public static void timeStop() {
		final long tmp = System.nanoTime();
		time = (tmp - time)/1000;
		System.out.println(time + " micro Seconds");
	}

}
